<?php
/**[留言查看]
 * @Author: 976123967@qq.com
 * @Date:   2014-09-16 19:37:29
 * @Last Modified by:   chen
 * @Last Modified time: 2014-10-28 22:34:44
 */
class FeedbackAction extends PublicAction{


	public function _initialize()
	{
		parent::_initialize();
		$this->model = D("Feedback");
	}


	/**
	 * [index 留言列表]
	 * @return [type] [description]
	 */
	public function index()
	{

		$data = $this->model->get_feedback_all();
		if($data)
		{
			$this->assign('page',$data['page']);
			unset($data['page']);
		}
		$this->assign('data',$data);
		$this->display();
	}




	/**
	 * [edit 查看详细信息]
	 * @return [type] [description]
	 */
	public function edit()
	{
		$fid = I('get.fid');
		$data= $this->model->get_feedabck_one($fid);	
		$this->assign('data',$data);

		//更新为已经查看
		$this->model->update_state($fid,2);
		$this->display();
	}




	/**
	 * [del 删除留言]
	 * @return [type] [description]
	 */
	public function del()
	{
		$fid = I('get.fid');
		$data= $this->model->get_feedabck_one($fid);	
		if(!$data) $this->error('链接错误！');
		$this->model->del_feedback($fid);
		$this->success('留言删除成功',U("Feedback/index"));
	}


	/**
	 * [del_all 删除选择的留言信息]
	 * @return [type] [description]
	 */
	public function del_all()
	{
	
		if(!$this->model->del_feedback_all()) $this->error($this->model->getError());
		$this->success('留言删除成功',U("Feedback/index"));
	}









}